import Mock, { mock } from "mockjs";
// var Mock = require('mockjs')
var Random = Mock.Random;

//道路站点
const data = Mock.mock({
  "data|20": [
    {
      "id|+1": 0,
      token: Random.guid(),
      kind11: "@csentence(7)",
      "state|1": ["0", "1"],
      sm: Random.word(),
      time: '@datetime("2022-MM-dd A HH:mm:ss")',
    },
  ],
});

// prolist  get
Mock.mock("/identify", "get", () => {
  return data;
});

//添加功能
Mock.mock("/identify/add", "post", (comfig) => {
  const data1 = JSON.parse(comfig.body);
  data1.id = data.data.length + 1;
  data.data.push(data1);
  return data;
});
//查询功能

Mock.mock("/identify/search", "post", (comfig) => {
  const data1 = JSON.parse(comfig.body);
  const data2 = data.data.filter((item) => {
    return (
      item.kind11 === data1.kin11 ||
      item.state === data1.state ||
      item.sm === data.sm
    );
  });
  console.log(data2);
  return data2;
});
//删除功能
Mock.mock("/identify/remove", "post", (comfig) => {
  const data1 = JSON.parse(comfig.body);
  data.data.forEach((item, index) => {
    if (item.id === data1.id) {
      data.data.splice(index, 1);
    }
  });
  return data;
});
///identify/set 设置当前数据
Mock.mock("/identify/set", "post", (comfig) => {
  const data1 = JSON.parse(comfig.body);
  console.log(data1);
  data.data.forEach((item, index) => {
    if (item.id === data1.id) {
      console.log(index);
      data.data.splice(index, 1, data1);
    }
  });

  return data;
});
///identify/set 查看当前数据
Mock.mock("/identify/wacth", "post", (comfig) => {
  const data1 = JSON.parse(comfig.body);
  console.log(data1);

  data.data.map((item) => {
    return item.id === data1.id;
  });
});

//图标3
const data2 = [
  {
    name: "已收停车费",
    year: "2000",
    gdp: 1211346869605.24,
  },
  {
    name: "已收停车费",
    year: "2001",
    gdp: 1339395718865.3,
  },
  {
    name: "已收停车费",
    year: "2002",
    gdp: 1470550015081.55,
  },
  {
    name: "已收停车费",
    year: "2003",
    gdp: 1660287965662.68,
  },
  {
    name: "已收停车费",
    year: "2004",
    gdp: 1955347004963.27,
  },
  {
    name: "已收停车费",
    year: "2005",
    gdp: 2285965892360.54,
  },
  {
    name: "已收停车费",
    year: "2006",
    gdp: 2752131773355.16,
  },
  {
    name: "已收停车费",
    year: "2007",
    gdp: 3550342425238.25,
  },
  {
    name: "已收停车费",
    year: "2008",
    gdp: 4594306848763.08,
  },
  {
    name: "已收停车费",
    year: "2009",
    gdp: 5101702432883.45,
  },
  {
    name: "已收停车费",
    year: "2010",
    gdp: 6087164527421.24,
  },
  {
    name: "已收停车费",
    year: "2011",
    gdp: 7551500425597.77,
  },
  {
    name: "已收停车费",
    year: "2012",
    gdp: 8532230724141.76,
  },
  {
    name: "已收停车费",
    year: "2013",
    gdp: 9570405758739.79,
  },
  {
    name: "已收停车费",
    year: "2014",
    gdp: 10438529153237.6,
  },
  {
    name: "已收停车费",
    year: "2015",
    gdp: 11015542352468.9,
  },
  {
    name: "已收停车费",
    year: "2016",
    gdp: 11137945669350.6,
  },
  {
    name: "已收停车费",
    year: "2017",
    gdp: 12143491448186.1,
  },
  {
    name: "已收停车费",
    year: "2018",
    gdp: 13608151864637.9,
  },
  {
    name: "应收停车费",
    year: "2000",
    gdp: 10252345464000,
  },
  {
    name: "应收停车费",
    year: "2001",
    gdp: 10581821399000,
  },
  {
    name: "应收停车费",
    year: "2002",
    gdp: 10936419054000,
  },
  {
    name: "应收停车费",
    year: "2003",
    gdp: 11458243878000,
  },
  {
    name: "应收停车费",
    year: "2004",
    gdp: 12213729147000,
  },
  {
    name: "应收停车费",
    year: "2005",
    gdp: 13036640229000,
  },
  {
    name: "应收停车费",
    year: "2006",
    gdp: 13814611414000,
  },
  {
    name: "应收停车费",
    year: "2007",
    gdp: 14451858650000,
  },
  {
    name: "应收停车费",
    year: "2008",
    gdp: 14712844084000,
  },
  {
    name: "应收停车费",
    year: "2009",
    gdp: 14448933025000,
  },
  {
    name: "应收停车费",
    year: "2010",
    gdp: 14992052727000,
  },
  {
    name: "应收停车费",
    year: "2011",
    gdp: 15542581104000,
  },
  {
    name: "应收停车费",
    year: "2012",
    gdp: 16197007349000,
  },
  {
    name: "应收停车费",
    year: "2013",
    gdp: 16784849190000,
  },
  {
    name: "应收停车费",
    year: "2014",
    gdp: 17521746534000,
  },
  {
    name: "应收停车费",
    year: "2015",
    gdp: 18219297584000,
  },
  {
    name: "应收停车费",
    year: "2016",
    gdp: 18707188235000,
  },
  {
    name: "应收停车费",
    year: "2017",
    gdp: 19485393853000,
  },
  {
    name: "应收停车费",
    year: "2018",
    gdp: 20544343456936.5,
  },
  {
    name: "未收停车费",
    year: "2000",
    gdp: 1657816613708.58,
  },
  {
    name: "未收停车费",
    year: "2001",
    gdp: 1640246149417.01,
  },
  {
    name: "未收停车费",
    year: "2002",
    gdp: 1784473920863.31,
  },
  {
    name: "未收停车费",
    year: "2003",
    gdp: 2053018775510.2,
  },
  {
    name: "未收停车费",
    year: "2004",
    gdp: 2416931526913.22,
  },
  {
    name: "未收停车费",
    year: "2005",
    gdp: 2538680000000,
  },
  {
    name: "未收停车费",
    year: "2006",
    gdp: 2713749770009.2,
  },
  {
    name: "未收停车费",
    year: "2007",
    gdp: 3100882352941.18,
  },
  {
    name: "未收停车费",
    year: "2008",
    gdp: 2922667279411.76,
  },
  {
    name: "未收停车费",
    year: "2009",
    gdp: 2410909799034.12,
  },
  {
    name: "未收停车费",
    year: "2010",
    gdp: 2475244321361.11,
  },
  {
    name: "未收停车费",
    year: "2011",
    gdp: 2659310054646.23,
  },
  {
    name: "未收停车费",
    year: "2012",
    gdp: 2704887678386.72,
  },
  {
    name: "未收停车费",
    year: "2013",
    gdp: 2786022872706.81,
  },
  {
    name: "未收停车费",
    year: "2014",
    gdp: 3063803240208.01,
  },
  {
    name: "未收停车费",
    year: "2015",
    gdp: 2928591002002.51,
  },
  {
    name: "未收停车费",
    year: "2016",
    gdp: 2694283209613.29,
  },
  {
    name: "未收停车费",
    year: "2017",
    gdp: 2666229179958.01,
  },
  {
    name: "未收停车费",
    year: "2018",
    gdp: 2855296731521.96,
  },
  {
    name: "优惠券",
    year: "2000",
    gdp: 259710142196.94,
  },
  {
    name: "优惠券",
    year: "2001",
    gdp: 306602070620.5,
  },
  {
    name: "优惠券",
    year: "2002",
    gdp: 345470494417.86,
  },
  {
    name: "优惠券",
    year: "2003",
    gdp: 430347770731.79,
  },
  {
    name: "优惠券",
    year: "2004",
    gdp: 591016690742.8,
  },
  {
    name: "优惠券",
    year: "2005",
    gdp: 764017107992.39,
  },
  {
    name: "优惠券",
    year: "2006",
    gdp: 989930542278.7,
  },
  {
    name: "优惠券",
    year: "2007",
    gdp: 1299705764823.62,
  },
  {
    name: "优惠券",
    year: "2008",
    gdp: 1660846387624.78,
  },
  {
    name: "优惠券",
    year: "2009",
    gdp: 1222644282201.86,
  },
  {
    name: "优惠券",
    year: "2010",
    gdp: 1524917468442.01,
  },
  {
    name: "优惠券",
    year: "2011",
    gdp: 2051661732059.78,
  },
  {
    name: "优惠券",
    year: "2012",
    gdp: 2210256976945.38,
  },
  {
    name: "优惠券",
    year: "2013",
    gdp: 2297128039058.21,
  },
  {
    name: "优惠券",
    year: "2014",
    gdp: 2059984158438.46,
  },
  {
    name: "优惠券",
    year: "2015",
    gdp: 1363594369577.82,
  },
  {
    name: "优惠券",
    year: "2016",
    gdp: 1282723881134.01,
  },
  {
    name: "优惠券",
    year: "2017",
    gdp: 1578624060588.26,
  },
  {
    name: "优惠券",
    year: "2018",
    gdp: 1657554647149.87,
  },
  {
    name: "赠送金额",
    year: "2000",
    gdp: 4887519660744.86,
  },
  {
    name: "赠送金额",
    year: "2001",
    gdp: 4303544259842.72,
  },
  {
    name: "赠送金额",
    year: "2002",
    gdp: 4115116279069.77,
  },
  {
    name: "赠送金额",
    year: "2003",
    gdp: 4445658071221.86,
  },
  {
    name: "赠送金额",
    year: "2004",
    gdp: 4815148854362.11,
  },
  {
    name: "赠送金额",
    year: "2005",
    gdp: 4755410630912.14,
  },
  {
    name: "赠送金额",
    year: "2006",
    gdp: 4530377224970.4,
  },
  {
    name: "赠送金额",
    year: "2007",
    gdp: 4515264514430.57,
  },
  {
    name: "赠送金额",
    year: "2008",
    gdp: 5037908465114.48,
  },
  {
    name: "赠送金额",
    year: "2009",
    gdp: 5231382674593.7,
  },
  {
    name: "赠送金额",
    year: "2010",
    gdp: 5700098114744.41,
  },
  {
    name: "赠送金额",
    year: "2011",
    gdp: 6157459594823.72,
  },
  {
    name: "赠送金额",
    year: "2012",
    gdp: 6203213121334.12,
  },
  {
    name: "赠送金额",
    year: "2013",
    gdp: 5155717056270.83,
  },
  {
    name: "赠送金额",
    year: "2014",
    gdp: 4850413536037.84,
  },
  {
    name: "赠送金额",
    year: "2015",
    gdp: 4389475622588.97,
  },
  {
    name: "赠送金额",
    year: "2016",
    gdp: 4926667087367.51,
  },
  {
    name: "赠送金额",
    year: "2017",
    gdp: 4859950558538.97,
  },
  {
    name: "赠送金额",
    year: "2018",
    gdp: 4971323079771.87,
  },
];


///identify/set 查看当前数据
Mock.mock("/identify/data1", "get", () => {
 return data2
});